//
//  WHMineInfoCell.m
//  SquirrelCourier
//
//  Created by 邓伟浩 on 2019/1/3.
//  Copyright © 2019 邓伟浩. All rights reserved.
//

#import "WHMineInfoCell.h"

@interface WHMineInfoCell ()

@property (nonatomic, strong) UIView *typeBackView;

@end

@implementation WHMineInfoCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        
        [self setUpUI];
    }
    return self;
}

- (void)setUpUI {
    [self.contentView addSubview:({
        _headImageView = [[UIImageView alloc] init];
        _headImageView.contentMode = UIViewContentModeScaleAspectFit;
        _headImageView.image = IMAGE_NAMED(@"mine_defaultHeader");
        ViewRadius(_headImageView, kRealwidth(45)/2);
        _headImageView;
    })];
    
    [_headImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(self.contentView.mas_left).offset(kRealwidth(15));
        make.width.mas_equalTo(kRealwidth(45));
        make.height.mas_equalTo(kRealwidth(45));
        make.centerY.mas_equalTo(self.contentView.mas_centerY);
    }];
    
    [self.contentView addSubview:({
        _nameLabel = [[UILabel alloc] init];
        _nameLabel.textColor = CFontTitleBlackColor;
        _nameLabel.font = SYSTEMFONT(kRealwidth(16));
        _nameLabel;
    })];
    [_nameLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_headImageView.mas_right).offset(kRealwidth(15));
        make.top.mas_equalTo(self.contentView.mas_top).offset(kRealwidth(15));
        make.height.mas_equalTo(kRealwidth(16));
    }];
    
    [self.contentView addSubview:({
        _phoneNumberLabel = [[UILabel alloc] init];
        _phoneNumberLabel.textColor = CFontTitleBlackColor;
        _phoneNumberLabel.font = SYSTEMFONT(kRealwidth(16));
        _phoneNumberLabel;
    })];
    [_phoneNumberLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.mas_equalTo(_nameLabel.mas_left);
        make.top.mas_equalTo(_nameLabel.mas_bottom).offset(kRealwidth(15));
        make.height.mas_equalTo(kRealwidth(16));
    }];
    
    [self.contentView addSubview:({
        _typeBackView = [[UIView alloc] init];
        ViewBorderRadius(_typeBackView, kRealwidth(20)/2, 1, CMDarkOrangeColor);
        _typeBackView;
    })];
    
    [_typeBackView addSubview:({
        _typeLabel = [[UILabel alloc] init];
        _typeLabel.textColor = CMDarkOrangeColor;
        _typeLabel.font = SYSTEMFONT(kRealwidth(12));
        _typeLabel;
    })];
    [_typeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(self.contentView.mas_right).offset(-kRealwidth(30));
        make.centerY.mas_equalTo(self.contentView.mas_centerY);
        make.height.mas_equalTo(kRealwidth(12));
    }];
    
    [_typeBackView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.right.mas_equalTo(_typeLabel.mas_right).offset(kRealwidth(15));
        make.left.mas_equalTo(_typeLabel.mas_left).offset(-kRealwidth(15));
        make.height.mas_equalTo(kRealwidth(20));
        make.centerY.mas_equalTo(_typeLabel.mas_centerY);
    }];
    
}


@end
